Time pattern (Cron)

An LDAP synchronization can be started automatically after a certain time interval. For this purpose, a trigger can be stored in the properties that contains a time pattern (cron), or a time pattern (cron) can be defined directly, after the expiration of which the LDAP synchronization is continuously triggered.

A time pattern is defined with a cron expression. A cron expression is a string consisting of 6 or 7 fields. The fields are separated by spaces.

The 6 mandatory fields and 1 optional field (year) are divided as follows:

"<1: seconds> <2: minutes> <3: hours> <4: day of the month> <5: month> <6: day of the week> <(7: year)>"

Field no.

Field name (time unit)

Allowed values

Allowed special characters

1

Seconds

0-59

, - * /

2

Minutes

0-59

, - * /

3

Hours

0-23

, - * /

4

Day of the month

1-31 (last day of month varies per month, e.g. February=28 or 29, December=31, June=30)

, - * ? / L W C

5

Month

1-12 or JAN-DEC

, - * /

6

Day of the week

1-7 or SUN-SAT

  • 1=Sunday

  • 2=Monday

  • 3=Tuesday

  • 4=Wednesday

  • 5=Thursday

  • 6=Friday

  • 7=Saturday

, - * ? / L C #

7

Year

blank field or 1970-2099

, - * /

Meaning of the special characters of a cron expression:

Special characters

used in the field

Description

*

all fields

All values of the corresponding time unit, e.g. "*" in the "Minute" field means every minute, i.e. 0, 1, 2, 3, ...59

?

"Day of the month"

or

"Day of the week"

Allowed in the "Day of the month" and "Day of the week" fields. It means "no specific value/any values" and is used when you put a specific value in one of the two fields, but not in the other. (This is the normal case, since you run a task either on certain days of the month, e.g. the 15th, which always falls on a different day of the week, or on certain days of the week, e.g. Fridays.)

See the table under Cron expression examples.

-

all fields

Used to define a range (from-to). E.g. "10-12" means the hours 10, 11 and 12.

,

all fields

Used as a separator for enumerating multiple values. E.g. "Mon, Wed, Fri" in the "Day-of-the-week" field means "Mondays, Wednesdays and Fridays".

/

all fields

Used to define an increment (up-counter) . The automatic increment starts with the first value and is automatically added by the second value. The frame i.e. the minimum and maximum values provide the respective allowed values of a field, e.g. 0 to 60 seconds (see table above). For example, in the "Seconds" field "0/15" means the sequence of numbers "0, 15, 30 and 45" and "5/15" means "5, 20, 35 and 50".

You can also use a "/" after a "*" character, this corresponds to a 0 before the "/" character, e.g. */10 = "0, 10, 20, 30, 40, 50".

L

"Day of the month"

or

"Day of the week"

Used in the "Day-of-the-month" and "Day-of-the-week" fields. "L" means "last".

In the Day-of-the-Month field, "L" means the last day of the month, e.g. 31 in January, 28 or 29 (leap year) for February.

In the "day-of-the-week" field, the "L" means the value "7" or "SAT".

If the "L" in the "day-of-the-week" field is placed after another value, it means "the last x-weekday of the month", e.g. "6L" stands for "the last Friday of the month".

If the "L" option is used, it is recommended not to define lists or ranges of values to avoid confusing results.

W

"Day of the month"

(if a single day of the month is specified)

The next working day within the respective month:

The value "W" can only be used for a single day in the month, not for a period or a list of days.

Used in the "Day-of-the-month" field and specifies a working day (Mon-Fri) in the given month closest to the specified day of the month. E.g. the value "15W" means the next weekday to the 15th of the month - when the 15th is a Saturday, Friday is taken - if it is a Sunday, Monday is taken. When the 15th is a working day, e.g. Thursday, then this working day is used.

If the value "1W" is defined in the "Day-of-the-month" field, and the 1st is a Saturday, then Monday, the 3rd. is used, as there is no jump over the monthly limit.

The combination "LW" means "Last working day of the month".

Example:  

"3W"

When the 3rd is a Saturday, then the task starts on Friday the 2nd, since Monday would be 2 days difference and Friday would be only one day difference.

When the 3rd is a Sunday, then the task starts on Monday the 4th, as Friday would be 2 days difference and Monday only 1 day difference.
When the 3rd is a Tuesday, then the task starts on that Tuesday, since it is a working day.

Example:

"1W", "31W" (special cases):

"1W": When the 1st is a Saturday, then the task starts on Monday the 3rd, because although Friday is the next working day, it is in a different month. Thus, Monday is the closest working day within the month.

#

respectively

weekday#n-th of the="" month=""

"Day of the week"

To be inserted in the "Day-of-the-week" field. The nth day of the week in the month is specified. For example, "2#1" or "MON#1" means the first Monday of the month and 6#3" means the 3rd Friday of the month.

If the defined nth weekday in the month does not exist, e.g. 1#20 i.e. the 20th Sunday in the month, then the job will not be triggered.

C

"Day-of-the-Month"

"Day-of-the-Week

The first day valid in the calendar from the date of the specified day of the month or week (for example, if an individual calendar does not take into account Sundays and holidays). - If no individual calendar is associated, then the general, complete calendar, without excluded days, is assumed.

The specified value will be matched with the individual calendar if available, otherwise with the general full calendar. For example, "5C" means the first day valid in the calendar, on or after the 5th day (of the month/week).

Example:

"5C" in the day-of-month field:

= The 5th day of the month, if valid in the calendar, or the first valid day of the month after the 5th day. des Monats.

Example:

"1C" in the day of the week:

= Sunday, if the calendar takes Sundays into account, or the first valid day of the week after Sunday in the calendar, e.g. Monday.

 

Example: of the cron expression

"<1: seconds> <2: minutes> <3: hours> <4: day of the month> <5: month> <6: day of the week> <(7: year)>"

cron expression

Task is triggered:

"0 0 12 * * ?"

at 12:00 a.m. every day

"0 15 10 ? * *"

at 10:15 a.m. every day

"0 15 10 * * ?"

at 10:15 a.m. every day

"0 15 10 * * ? *"

at 10:15 a.m. every day

"0 15 10 * * ? 2014"

at 10:15 a.m. every day in 2014

0 0 * ? * ?

Every hour

"0 * 14 * * ?"

from 2 p.m., every minute until 2:59 p.m. every day

"0 0/5 14 * * ?"

from 2:00 p.m., every 5 minutes until 2:55 p.m., every day

"0 0/5 14,18 * * ?"

every 5 minutes from 2 p.m. to 2:55 p.m. and from 6 p.m. to 6:55 p.m., every day

"0 0-5 14 * * ?"

every minute from 2:00 p.m. to 2:05 p.m., every day

"0 10.44 14 ? 3 WED"

at 2:10 p.m. and at 2:44 p.m., every Wednesday in the month of March.

"0 15 10 ? * MON-FRI"

At 10:15 a.m. always from Monday to Friday (Monday, Tuesday, Wednesday, Thursday, Friday)

0 15 20 ? * 2-6

At 8:15 p.m. always from Monday to Friday

"0 15 10 15 * ?"

At 10:15 a.m. on the 15th day of each month

"0 15 10 L * ?"

At 10:15 a.m. on the last day of the month

0 0 20 ? * 6

every friday at 8 p.m.

"0 15 10 ? * 6L"

At 10:15 a.m. on the last Friday of each month

0 30 22 ? * 6L 2014

At 10:30 p.m. every last Friday of every month in 2014

"0 15 10 ? * 6L 2014-2020"

At 10:15 a.m. on the last Friday of each month from the year 2014 to 2020.

0 0 21 ? * 2,4,6 2014-2016

At 9:00 p.m., Mondays, Wednesdays and Fridays from 2014 to 2016.

"0 15 10 ? * 6#3"

At 10:15 a.m. on the third Friday of each month

0 0/20 14 ? * 2-6

Always: Monday to Friday at 2:00 p.m.,2:20 p.m. and 2:40 p.m..